package com.demo.launcher;

import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

/**
 * @author : Zach
 * @desc :
 * @date : 2021/11/9 17:00
 */
public class TargetActivity extends AppCompatActivity {

    TextView tvText;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_target);
        tvText = findViewById(R.id.tvText);
        Intent intent = getIntent();
        if (intent.getExtras() != null) {
            tvText.setText("" + intent.toUri(0));
        }
    }

    @Override
    public void finish() {
        setResult();
        super.finish();
    }

    private void setResult() {
        Intent intent = new Intent();
        intent.putExtra("key1", "hehe");
        intent.putExtra("key2", 2);
        setResult(RESULT_OK, intent);
    }
}
